Array.prototype.orderAsc=function(campo){
    this.sort(function() {
            return function(a, b){
                    var objectIDA = a[campo];
                    var objectIDB = b[campo];
                    if (objectIDA === objectIDB) {
                            return 0;
                    }
                    return objectIDA > objectIDB ? 1 : -1;        
            };
    }());
};
Array.prototype.orderDesc = function(campo){
	this.reverse(function() {
		return function(a, b){
			var objectIDA = a[campo];
			var objectIDB = b[campo];
			if (objectIDA === objectIDB) {
				return 0;
			}
			return objectIDA > objectIDB ? 1 : -1;        
		};
	}());
};


Array.prototype.buscaBinaria=function(campo,valor){
    var ind = -1;
    var tmI=this.length;
    for(var i = 0;i<tmI;i++){
        if(this[i][campo] == valor){
                ind = i;
                break;
        }
    }
    return ind;   
};

Array.prototype.busca=function(campo,valor){
    var ind = -1;
    var tmI=this.length;
    for(var i = 0;i<tmI;i++){
        if(this[i][campo] == valor){
                ind = i;
                break;
        }
    }
    return ind;   
};

if (!Array.prototype.filter)
{
Array.prototype.filter = function(fun){
    var len = this.length;
    if (typeof fun != "function"){
      throw new TypeError();
  	}
    var res = new Array();
    var thisp = arguments[1];
    for (var i = 0; i < len; i++){
      if (i in this){
        var val = this[i]; // in case fun mutates this
        if (fun.call(thisp, val, i, this)){
        	res.push(val);
        }
      }
    }
    return res;
  };
}